﻿@using System.Globalization
@model Project.Domain.Entities.League
@{
    var controller = ViewContext.Controller.ValueProvider.GetValue("controller").RawValue.ToString();
    ViewBag.Title = "Modify" + controller.ToString(CultureInfo.InvariantCulture);
    var id = Convert.ToInt32(ViewBag.Id);
}

<script type="text/javascript">
    function save() {
        var options = {
            beforeSubmit: showRequest,  // pre-submit callback 
            success: showResponse  // post-submit callback 
        };
        $('#contentAdmincp').val(oEdit1.getTextBody());
        $('#frmManagement').ajaxSubmit(options);
    }

    function showRequest(formData, jqForm, options) {
        var form = jqForm[0];
        if (form.contentAdmincp.value == '') {
            alert('Vui lòng điền đầy đủ thông tin.');
            return false;
        }
    }

    function showResponse(responseText, statusText, xhr, $form) {
        if (responseText == '1') {
            var url = root + "Admin/" + "@controller.ToString()" + "/#/save";
            location.href = url;
        }
    }
</script>

<div class="table">
    <div class="head_table"><div class="head_title_edit">@controller</div></div>
    <div class="clearAll"></div>
    @using (Html.BeginForm("Modify", "League", FormMethod.Post, new { id = "frmManagement" }))
    {
        <input type="hidden" value="@ViewBag.Id" name="hiddenIdAdmincp" />
        <div class="row_text_field_first">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                <tr>
                    <td class="left_text_field">Status:</td>
                    <td class="right_text_field">                                                
                        <input type="checkbox" class="custom_chk" name="statusAdmincp" />                                               
                    </td>
                </tr>
            </table>
        </div>

        <div class="row_text_field">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                <tr>
                    <td class="left_text_field">League Name:</td>
                    <td class="right_text_field">                                                
                        @if (id > 0)
                        {
                            <textarea name="contentAdmincp" id="contentAdmincp" cols="" rows="8" >@Model.NameLeague</textarea>
                        }

                        else
                        {
                            <textarea name="contentAdmincp" id="contentAdmincp" cols="" rows="8" ></textarea>
                        }
                        <script type="text/javascript">
                            var oEdit1 = new InnovaEditor("oEdit1");
                            oEdit1.width = "100%";
                            oEdit1.cmdAssetManager = "modalDialogShow('/Areas/Content/editor/assetmanager/assetmanager.asp',640,445);";
                            oEdit1.REPLACE("contentAdmincp");
                        </script>                                                           
                    </td>
                </tr>
            </table>
        </div>
    }
</div>

